using System;
using System.Collections.Generic;
using System.Text;
using Dapper.Contrib.Extensions;
using DapperExtensions.Mapper;
using Publicuse.Entity.AttributeUtil;
using Publicuse.Entity.AttributeUtil.Validate;
using SqlSugar;

namespace Publicuse.Entity
{
  /// <summary>
  /// 黑白名单管理模块管理
  /// </summary>
  [DBTable("`geeker-whitesinglename`", "黑白名单信息")]
  [Table("`geeker-whitesinglename`")]
  [SugarTable("`geeker-whitesinglename`")]
  public class Whitesinglename : BaseModel<long>
  {
    [Remark("IP地址")]
    [IP("IP地址格式不正确")]
    public string IPAddress { get; set; }

    [Remark("IP编码")]
    [Format(@"^.{3,50}$", "长度为3-50位字符")]
    public string IPCode { get; set; }

    [Remark("类型 1=白名单 2=黑名单")]
    public int type { get; set; } = -1;

    public Whitesinglename()
    {
      this.Id = 0;
    }
  }

  /// <summary>
  /// 黑白名单管理查询参数
  /// </summary>
  public class WhitesinglenameQuery : CommonQuery
  {
    public WhitesinglenameQuery()
    {
      this.exportName = GetExportName;
      this.businessType = BusinessType.whitesinglename;
    }

    public static string GetExportName
    {
      get { return "whitesinglename"; }
    }
  }
}
